package BusinessLogic;

import java.util.ArrayList;

import Data.ReturnGoodRecord;
import Data.SaleRecordData;
import Data.SaleRecordDataOperator;

public class ReturnController implements IReturnController{

	private ReturnModel rm = new ReturnModel();
	
	public ReturnController(){
		ReturnModel rm = new ReturnModel();
	}
	
	public SaleRecordData getSaleRecordDataBySaleIDControl(int SaleID){
		return rm.getSaleRecordDataBySaleID(SaleID);
	}
	
	public boolean addItemControl(int SaleID,int GoodID,int GoodNumber,double price,double specialPrice,String date){
		try{
			return rm.addItem(SaleID,GoodID,GoodNumber,price,specialPrice,date);
		}catch(Exception e){
		return false;
		}
	}
	
	public boolean removeItemControl(int SaleID,int GoodID,int GoodNumber,double price,double specialPrice,String date){
		try{
			return rm.removeItem(SaleID,GoodID,GoodNumber,price,specialPrice,date);
		}catch(Exception e){
			return false;
		}
	}
	
	public double returnGoodControl(){
		return rm.returnGood();
	}
	
	public boolean startUpdateControl(){
		return rm.startUpdate();
	}
	
	public String getGoodDescriptionByIDControl(int ID){
		return rm.getGoodDescriptionByID(ID);
	}
	
	public double getGoodPriceByIDControl(int ID){
		return rm.getGoodPriceByID(ID);
	}
	
	public double getGoodSpecialPriceByIDControl(int ID){
		return rm.getGoodSpecialPriceByID(ID);
	}
	
	public String getGoodSpecialTimeStartByIDControl(int ID){
		return rm.getGoodSpecialTimeStartByID(ID);
	}
	
	public String getGoodSpecialTimeEndByIDControl(int ID){
		return rm.getGoodSpecialTimeEndByID(ID);
	}
	
	public double getGoodNumberByIDControl(int ID){
		return rm.getGoodNumberByID(ID);
	}
	
	public String getUserNameByIDControl(int ID){
		return rm.getUserNameByID(ID);
	}
	
	public String getUserPasswordByIDControl(int ID){
		return rm.getUserPasswordByID(ID);
	}
	
	public Double getGoodOriginalPriceByIDControl(int ID){
		return rm.getGoodOriginalPriceByID(ID);
	}
	
	public Double getGoodOriginalSpecialPriceByIDControl(int ID){
		return rm.getGoodOriginalSpecialPriceByID(ID);
	}
	
	public String getSaleDateByIDControl(int ID){
		return rm.getSaleDateByID(ID);
	}
	
	public int getNextReturnIDControl(){
		return rm.getNextReturnID();
	}
	
	public boolean saveReturnGoodRecordControl(int goodID,String goodName,double returnNumber,double price,double specialPrice,String returnDate,int saleID){
		return rm.saveReturnGoodRecord(goodID, goodName, returnNumber, price, specialPrice, returnDate, saleID);
	}
	
	public ArrayList<ReturnGoodRecord> readReturnGoodRecordBySaleIDControl(int ID){
		return rm.readReturnGoodRecordBySaleID(ID);
	}
	
	
}
